package com.dingup.paike.service.message.impl;

import com.dingup.api.Util.DateUtil;
import com.dingup.paike.adapter.pk.PkLessonUserAdapter;
import com.dingup.paike.dao.PkLessonInfoMapper;
import com.dingup.paike.dao.PkLessonUserMapper;
import com.dingup.paike.service.message.MessageService;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by wancheng on 2018/10/22.
 */
@Service
public class MessageServiceImpl implements MessageService {

    @Autowired
    PkLessonInfoMapper pkLessonInfoMapper;
    @Autowired
    PkLessonUserMapper pkLessonUserMapper;

    @Override
    public List<PkLessonUserAdapter> getPkLessonUserInfoForTomorrow() {
        Date currentDate = new Date();
        String tomorrowDate = DateUtil.date2Str(DateUtils.addDays(currentDate, 1), "yyyy-MM-dd");
        List<PkLessonUserAdapter> list = pkLessonUserMapper.getPkLessonMsgByBeginTimeDay(tomorrowDate);
        return list;
    }
}
